﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class LocalObjectStorage : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        string username = PlayerPrefs.GetString("username");  //没有获取到数据返回默认空字符串
        if (username.Equals(""))
        {
            Debug.Log("first set ");
            PlayerPrefs.SetString("username","zhangsan");
        }
        else
        {
            Debug.Log($"read from localstorage username:{username}" );
        }
    }

    // Update is called once per frame
    void Update()
    {
        
    }
}
